<template>
    <div id="coupon">
        <div id="list">
            <div class="Broker" v-for="x in uselist" :key="x.id" :id="x.id" :type="x.type" @click="goOrder(x.min_money,x.id)">
                <ul class="left">
                    <li class="money"><span>¥</span>{{x.min_money}}</li>
                    <li class="text">满{{x.max_money}}元可用</li>
                </ul>
                <ul class="right">
                    <!--<li class="name">{{x.title}}</li>-->
                    <li class="name">{{x.subTitle}}</li>
                    <li class="time">{{x.stime}}</li>
                </ul>
                <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/more@2x.png" class="lt" >
            </div>
        </div>
    </div>
</template>

<script>
    import config from "../config/config.js";
    import share from "../share/share.js";
    export default {
        data(){
            return{
                uselist:[]
            }
        },
        methods:{
            GetCoupon(price){
                var value=JSON.stringify({"type":4,"price":price,"token":localStorage.getItem('token')}),
                    key=demo(value);
                axios.post('/Home/Coupon/GetCoupon',{
                    value:value,
                    key:key
                },config)
                    .then(function(response) {
                        this.uselist=response.data.data;
                    }.bind(this))
                    .catch(function (error) {
                        console.log(error);
                    });
            },
            goOrder(money,id){
                var couponInfo={
                    money:money,
                    id:id
                }
                couponInfo=JSON.stringify(couponInfo);
                localStorage.setItem('couponInfo',couponInfo);
                this.$router.go(-1);
            }
        },
        activated(){
            this.GetCoupon(this.$route.params.money)
        }
    }
</script>

<style scoped>

</style>